// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage
const functionTest = '../testContent/function'
const easeToUse = '../testContent/easeToUse'
// 跳转测试
const link = require(functionTest + '/link')
// 易用性测试
const textcontent = require(easeToUse + '/textcontent')

const testAll = require('../testAll')

module.exports = {
  'default e2e tests': function (browser) {
    // automatically uses dev Server port from /config.index.js
    // default: http://localhost:8080
    // see nightwatch.conf.js
    const devServer = browser.globals.devServerURL

    browser.url(devServer).waitForElementVisible('#app', 5000)
    testAll('是否在登陆页面', () => {
      browser.assert.elementPresent('.login')
    })
    /*
     功能测试
     */
    // 跳转测试
    testAll('链接是否正确跳转', (browser) => {
      link(browser)
    })

    /*
     易用性测试
     */
    // 页面内容测试
    testAll('页面内容是否正确', (browser) => {
      textcontent(browser)
    })
    browser.end()
  }
}
